package com.itedge.solutionmanager.taskdata.impl.customer;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import javax.persistence.Version;
import javax.validation.constraints.Size;

import com.itedge.solutionmanager.domain.impl.ContactPerson;
import com.itedge.infrastructure.taskdata.impl.AbstractTaskDataEntity;

@Entity
@Table(name="REMOVE_CONTACTS_TASK_DATA")
public class RemoveContactsTaskData extends AbstractTaskDataEntity {
	
	@Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id")
    private Long id;	

	@Version
    @Column(name = "version")
    private Integer version;
	
	@ManyToMany(cascade = CascadeType.ALL)
    @JoinTable(name="TASKS_CONTACTS",
            joinColumns=@JoinColumn(name="TASK_DATA_ID"),
            inverseJoinColumns=@JoinColumn(name="CONTACT_ID")
        )
	private Set<ContactPerson> relatedContacts = new HashSet<ContactPerson>();
    
	@Column(name ="REMOVED_CONTACT_IDS")
	@Size(max = 2000)
	private String removedContactsIds;

	public Set<ContactPerson> getRelatedContacts() {
		return relatedContacts;
	}

	public void setRelatedContacts(Set<ContactPerson> relatedContacts) {
		this.relatedContacts = relatedContacts;
	}

	public String getRemovedContactsIds() {
		return removedContactsIds;
	}

	public void setRemovedContactsIds(String removedContactsIds) {
		this.removedContactsIds = removedContactsIds;
	}

	@Override
	public Long getId() {
        return this.id;
    }

	public void setId(Long id) {
        this.id = id;
    }	

	@Override
	public Integer getVersion() {
        return this.version;
    }

	@Override
	public void setVersion(Integer version) {
        this.version = version;
    }
}